package com.aaa.controller;


import com.aaa.param.LoginParam;
import com.aaa.result.Result;
import com.aaa.utils.StrUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

@RestController
@RequestMapping("/abb")
public class AbbController {


    @PostMapping("/login")
    public Result<Objects> login(@RequestBody LoginParam loginParam) {

        if (Objects.isNull(loginParam)) {
            return Result.failure("参数错误");
        }
        String username = loginParam.getUsername();
        String password = loginParam.getPassword();
        if (StrUtil.isBlank(username)){
            return Result.failure("用户名不能为空");
        }
        if (StrUtil.isBlank(password)){
            return Result.failure("密码不能为空");
        }
        return null;
    }
}
